import uuid
from typing import Any

import pytest

from recruit.domain.models.user import UserCreate, UserResult, UserUpdate
from .utils import check_attr_model, check_json_schema


@pytest.mark.parametrize(
    'data, keys', [(
            {
                'user_id': 1,
                'username': '@username'
            },
            ('userId', 'username')
    )]
)
def test_user_create(data: dict[str, Any], keys: tuple[str, ...]) -> None:
    check_attr_model(UserCreate, data)
    check_json_schema(UserCreate, keys)


@pytest.mark.parametrize(
    'data, keys', [(
            {
                'id': uuid.uuid4(),
                'user_id': 1,
                'username': '@username'
            },
            ('id', 'userId', 'username')
    )]
)
def test_user_result(data: dict[str, Any], keys: tuple[str, ...]) -> None:
    check_attr_model(UserResult, data)
    check_json_schema(UserResult, keys)


@pytest.mark.parametrize(
    'data, keys', [(
            {
                'username': '@username'
            },
            ('username',)
    )]
)
def test_user_update(data: dict[str, Any], keys: tuple[str, ...]) -> None:
    check_attr_model(UserUpdate, data)
    check_json_schema(UserUpdate, keys)
